package org.mikrosopht.client;

public class MovieListSort {
  private final String name;

  private MovieListSort(String name) {
    this.name = name;
  }

  public String toString() {
    return name;
  }

  public static MovieListSort fromString(String name) {
    if (name.equals("name")) {
      return NAME_ASCENDING;
    } else if (name.equals("-name")) {
      return NAME_DESCENDING;
    } else if (name.equals("tally")) {
      return TALLY_ASCENDING;
    } else if (name.equals("-tally")) {
      return TALLY_DESCENDING;
    } else if (name.equals("date_added")) {
      return DATE_ADDED_ASCENDING;
    } else if (name.equals("-date_added")) {
      return DATE_ADDED_DESCENDING;
    } else if (name.equals("review_average_score")) {
      return REVIEW_SCORE_ASCENDING;
    } else if (name.equals("-review_average_score")) {
      return REVIEW_SCORE_DESCENDING;
    } else if (name.equals("screening_date")) {
      return SCREENING_DATE_DESCENDING;
    }
    return null;
  }

  public final static MovieListSort NAME_ASCENDING = new MovieListSort("name");
  public final static MovieListSort NAME_DESCENDING = new MovieListSort("-name");
  public final static MovieListSort TALLY_ASCENDING = new MovieListSort("tally");
  public final static MovieListSort TALLY_DESCENDING = new MovieListSort("-tally");
  public final static MovieListSort DATE_ADDED_ASCENDING = new MovieListSort("date_added");
  public final static MovieListSort DATE_ADDED_DESCENDING = new MovieListSort("-date_added");
  public final static MovieListSort REVIEW_SCORE_ASCENDING = new MovieListSort("review_average_score");
  public final static MovieListSort REVIEW_SCORE_DESCENDING = new MovieListSort("-review_average_score");
  public final static MovieListSort SCREENING_DATE_DESCENDING = new MovieListSort("screening_date");
}
